import { getInfo } from '@/api/login'

const state = {
	info: {}
}
const mutations = {
	SET_INFO: (state, info) => {
		state.info = info
	}
}

const actions = {
	// 获取用户信息
	GetInfo({ commit, state }) {
		return new Promise((resolve, reject) => {
			getInfo().then(response => {
				commit('SET_INFO', response)
				resolve()
			}).catch(error => {
				reject(error)
			})
		})
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}